--
-- Author: yawei.zhu
-- Date: 2019-01-14 16:03:12
--
local Daibi = require("app.public.dao.Daibi")

local fileName = string.getModeName(...)
local ClassRef = class(fileName)

function ClassRef:ctor(data)
    if data then
        self:init(data)
    end
end

-- message ChallengeReward {
--   ChallengeRewardItem rewardItem = 1;
-- }


-- message ChallengeRewardItem {
--   ChallengeRewardType rewardType = 1;
--   pb_loot.Loot loot = 2;
--   int32 itemCount = 3;
-- }

function ClassRef:init(data) 
	local item = data.rewardItem
	if not item then return end
	if item.rewardType == "challengeScore" then
		-- 挑战赛经验
		self.itemData = Daibi.new()
		self.itemData:read({tid=113, amount=item.itemCount})
	elseif item.rewardType == "challengeStar" then
		-- 挑战赛星章
		-- donothing 暂时不处理
	else
		self.itemData = UD:parseLootToBagItem(item.loot)
	end
end

return ClassRef
